cantor's pairing function. There are any references about cantor's pairing function in here. you can look below.